Optimal. Leaf size=63 \[ \frac {a (i A+B) (c-i c \tan (e+f x))^n}{f n}-\frac {a B (c-i c \tan (e+f x))^{1+n}}{c f (1+n)} \]
[Out]
________________________________________________________________________________________
Rubi [A]
time = 0.06, antiderivative size = 63, normalized size of antiderivative = 1.00, number of steps
used = 3, number of rules used = 2, integrand size = 39, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.051, Rules used = {3669, 45}
\begin {gather*} \frac {a (B+i A) (c-i c \tan (e+f x))^n}{f n}-\frac {a B (c-i c \tan (e+f x))^{n+1}}{c f (n+1)} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
Rule 45
Rule 3669
Rubi steps
\begin {align*} \int (a+i a \tan (e+f x)) (A+B \tan (e+f x)) (c-i c \tan (e+f x))^n \, dx &=\frac {(a c) \text {Subst}\left (\int (A+B x) (c-i c x)^{-1+n} \, dx,x,\tan (e+f x)\right )}{f}\\ &=\frac {(a c) \text {Subst}\left (\int \left ((A-i B) (c-i c x)^{-1+n}+\frac {i B (c-i c x)^n}{c}\right ) \, dx,x,\tan (e+f x)\right )}{f}\\ &=\frac {a (i A+B) (c-i c \tan (e+f x))^n}{f n}-\frac {a B (c-i c \tan (e+f x))^{1+n}}{c f (1+n)}\\ \end {align*}
________________________________________________________________________________________
Mathematica [A]
time = 1.77, size = 75, normalized size = 1.19 \begin {gather*} \frac {i a e^{n (-\log (c \sec (e+f x))+\log (c-i c \tan (e+f x)))} (c \sec (e+f x))^n (A-i B+A n+B n \tan (e+f x))}{f n (1+n)} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [A]
time = 1.35, size = 80, normalized size = 1.27
method | result | size |
norman | \(\frac {\left (i A a n +i a A +a B \right ) {\mathrm e}^{n \ln \left (c -i c \tan \left (f x +e \right )\right )}}{f n \left (1+n \right )}+\frac {i a B \tan \left (f x +e \right ) {\mathrm e}^{n \ln \left (c -i c \tan \left (f x +e \right )\right )}}{f \left (1+n \right )}\) | \(80\) |
risch | \(\text {Expression too large to display}\) | \(1205\) |
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [B] Both result and optimal contain complex but leaf count of result is larger than
twice the leaf count of optimal. 326 vs. \(2 (59) = 118\).
time = 0.58, size = 326, normalized size = 5.17 \begin {gather*} \frac {{\left ({\left (A - i \, B\right )} a c^{n} n + {\left (A - i \, B\right )} a c^{n}\right )} 2^{n} \cos \left (-2 \, f x + n \arctan \left (\sin \left (2 \, f x + 2 \, e\right ), \cos \left (2 \, f x + 2 \, e\right ) + 1\right ) - 2 \, e\right ) + {\left ({\left (A + i \, B\right )} a c^{n} n + {\left (A - i \, B\right )} a c^{n}\right )} 2^{n} \cos \left (n \arctan \left (\sin \left (2 \, f x + 2 \, e\right ), \cos \left (2 \, f x + 2 \, e\right ) + 1\right )\right ) - {\left ({\left (i \, A + B\right )} a c^{n} n + {\left (i \, A + B\right )} a c^{n}\right )} 2^{n} \sin \left (-2 \, f x + n \arctan \left (\sin \left (2 \, f x + 2 \, e\right ), \cos \left (2 \, f x + 2 \, e\right ) + 1\right ) - 2 \, e\right ) - {\left ({\left (i \, A - B\right )} a c^{n} n + {\left (i \, A + B\right )} a c^{n}\right )} 2^{n} \sin \left (n \arctan \left (\sin \left (2 \, f x + 2 \, e\right ), \cos \left (2 \, f x + 2 \, e\right ) + 1\right )\right )}{{\left (-i \, n^{2} + {\left (-i \, n^{2} - i \, n\right )} \cos \left (2 \, f x + 2 \, e\right ) + {\left (n^{2} + n\right )} \sin \left (2 \, f x + 2 \, e\right ) - i \, n\right )} {\left (\cos \left (2 \, f x + 2 \, e\right )^{2} + \sin \left (2 \, f x + 2 \, e\right )^{2} + 2 \, \cos \left (2 \, f x + 2 \, e\right ) + 1\right )}^{\frac {1}{2} \, n} f} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [A]
time = 1.64, size = 96, normalized size = 1.52 \begin {gather*} \frac {{\left ({\left (i \, A - B\right )} a n + {\left (i \, A + B\right )} a + {\left ({\left (i \, A + B\right )} a n + {\left (i \, A + B\right )} a\right )} e^{\left (2 i \, f x + 2 i \, e\right )}\right )} \left (\frac {2 \, c}{e^{\left (2 i \, f x + 2 i \, e\right )} + 1}\right )^{n}}{f n^{2} + f n + {\left (f n^{2} + f n\right )} e^{\left (2 i \, f x + 2 i \, e\right )}} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [B] Both result and optimal contain complex but leaf count of result is larger than twice
the leaf count of optimal. 394 vs. \(2 (48) = 96\).
time = 0.66, size = 394, normalized size = 6.25 \begin {gather*} \begin {cases} x \left (A + B \tan {\left (e \right )}\right ) \left (i a \tan {\left (e \right )} + a\right ) \left (- i c \tan {\left (e \right )} + c\right )^{n} & \text {for}\: f = 0 \\\frac {2 A a}{2 c f \tan {\left (e + f x \right )} + 2 i c f} + \frac {2 i B a f x \tan {\left (e + f x \right )}}{2 c f \tan {\left (e + f x \right )} + 2 i c f} - \frac {2 B a f x}{2 c f \tan {\left (e + f x \right )} + 2 i c f} - \frac {B a \log {\left (\tan ^{2}{\left (e + f x \right )} + 1 \right )} \tan {\left (e + f x \right )}}{2 c f \tan {\left (e + f x \right )} + 2 i c f} - \frac {i B a \log {\left (\tan ^{2}{\left (e + f x \right )} + 1 \right )}}{2 c f \tan {\left (e + f x \right )} + 2 i c f} - \frac {2 i B a}{2 c f \tan {\left (e + f x \right )} + 2 i c f} & \text {for}\: n = -1 \\A a x + \frac {i A a \log {\left (\tan ^{2}{\left (e + f x \right )} + 1 \right )}}{2 f} - i B a x + \frac {B a \log {\left (\tan ^{2}{\left (e + f x \right )} + 1 \right )}}{2 f} + \frac {i B a \tan {\left (e + f x \right )}}{f} & \text {for}\: n = 0 \\\frac {i A a n \left (- i c \tan {\left (e + f x \right )} + c\right )^{n}}{f n^{2} + f n} + \frac {i A a \left (- i c \tan {\left (e + f x \right )} + c\right )^{n}}{f n^{2} + f n} + \frac {i B a n \left (- i c \tan {\left (e + f x \right )} + c\right )^{n} \tan {\left (e + f x \right )}}{f n^{2} + f n} + \frac {B a \left (- i c \tan {\left (e + f x \right )} + c\right )^{n}}{f n^{2} + f n} & \text {otherwise} \end {cases} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {could not integrate} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Mupad [B]
time = 1.11, size = 128, normalized size = 2.03 \begin {gather*} -\frac {\left (\cos \left (e+f\,x\right )-\sin \left (e+f\,x\right )\,1{}\mathrm {i}\right )\,{\left (c-\frac {c\,\sin \left (e+f\,x\right )\,1{}\mathrm {i}}{\cos \left (e+f\,x\right )}\right )}^n\,\left (\frac {a\,\left (A-B\,1{}\mathrm {i}+A\,n+B\,n\,1{}\mathrm {i}\right )}{f\,n\,\left (n\,1{}\mathrm {i}+1{}\mathrm {i}\right )}+\frac {a\,\left (A-B\,1{}\mathrm {i}\right )\,\left (\cos \left (2\,e+2\,f\,x\right )+\sin \left (2\,e+2\,f\,x\right )\,1{}\mathrm {i}\right )\,\left (n+1\right )}{f\,n\,\left (n\,1{}\mathrm {i}+1{}\mathrm {i}\right )}\right )}{2\,\cos \left (e+f\,x\right )} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________